package com.chixing.day07_abstract.prototype;

public class ProductTest {
    public static void main(String[] args) throws CloneNotSupportedException {
        Product product = new Product();
        product.setPtoId(101);
        product.setProName("矿泉水");
        product.setProPrice(2.1f);

       Object cloneObj = product.clone();
        System.out.println("原始对象: " + product);
        System.out.println("克隆对象: " + cloneObj);

        //product的克隆对象

       /* Product proClone = new Product();
        proClone.setPtoId(proClone);*/



        // 创建一个Company对象, 克隆一个Company 对象
        //一模一样 在内存里是两个独立的对象
        Company company = new Company();
        company.setCompanyId(11);
        company.setCompanyName("华为");
        company.setCompanyType("民营");
        company.setCompanyAddress("江苏");
        company.setCompanyTelno(123456787l);


        Object cloneObj1 = company.clone();


        System.out.println("原始对象: " + company);
        System.out.println("克隆对象: " + cloneObj1);

        // 创建一个Job对象，, 克隆一个 Job 对象
        Job job = new Job();
        job.setJobId(12);
        job.setCompany(company);
        job.setJobName("java工程师");
        job.setJobMinSalary(5000);
        job.setJobMaxSalary(20000);
        job.setJobDegree("");
        job.setJobCity("苏州");

        Object cloneObj2 = job.clone();

        System.out.println("原始对象: " + job);
        System.out.println("克隆对象: " + cloneObj2);
    }
}
